import { CommonStore } from "@/store";


const useFormat = ()=>{
    const {storeList,userList} = CommonStore();
    const formatStaff = (text:string|number)=>{
        let exist = userList.find((statff)=>{
            return statff.userId == text;
        })
        return exist? `[${text}]${exist.nickName}` : ""
    }

    const formatStore = (text:string|number)=>{
        let exist = storeList.find((store)=>{
            return store.storeCode == text;
        })
        return exist?`[${text}]${exist.storeName}`:""
    }

    return {
        formatStaff,
        formatStore
    }
}

export default useFormat;